package cn.arikeky.mapper;

import cn.arikeky.domain.User;
import cn.arikeky.query.UserQuery;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {
    // 查询全部
    @Select("select * from p_user")
    List<User> findUserAll();

    // 添加
    @Insert("insert into p_user(username,alias,password,creationTime,state,dept_id,user_creator) " +
            "values(#{username}, #{alias}, #{password}, #{creationTime}, #{state}, #{dept_id}, #{user_creator})")
    void add(User user);

    // 修改
    void update(User user);

    // 根据id删除
    void delete(Long id);

    // 根据Id查询一个
    User findById(Long id);

    // 查询账号密码
    @Select("select * from p_user where username = #{username} and password = #{password}")
    User findUser(User user);

    Integer queryByCount(UserQuery userQuery);

    List<User> queryByPage(UserQuery userQuery);
}
